﻿<%@ include file="../include/top.jsp" %>
<%@ include file="../include/errorArea.jsp" %>
		
<link rel="stylesheet" href="${baseURL}/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="${baseURL}/js/swfupload/swfupload.js"></script>
	<script type="text/javascript" src="${baseURL}/js/fileprogress.js"></script>
	<script type="text/javascript" src="${baseURL}/js/swfupload.queue.js"></script>
	<script  type="text/javascript" src="${baseURL}/js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="${baseURL}/js/handlers.js"></script>
<script language="javascript" type="text/javascript" src="${baseURL}/js/jquery.ztree.all-3.5.min.js">
</script>
<SCRIPT type="text/javascript">
	var setting = {
		view: {
			dblClickExpand: false
		},
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			onClick: onClick
		}
	};

	
	 var upload;
	  window.onload = function() {
		upload = new SWFUpload({
		// 处理文件上传的url
		upload_url: "${ctx}/supplierProduct/uploadPic",	// 路径写全，否则Firefox下会出现404错误。自由修改处一：处理文件上传的url路径，注意还要写全部
		// 上传文件限制设置
		file_size_limit : "10240",	// 10MB
		file_types : "*.jpg;*.gif;*.png",	//此处也可以修改成你想限制的类型，比如：*.doc;*.wpd;*.pdf
		file_types_description : "Image Files",
		file_upload_limit : "5",
		file_queue_limit : "5",

		// 事件处理设置（所有的自定义处理方法都在handler.js文件里）
		file_dialog_start_handler : fileDialogStart,
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_start_handler : uploadStart,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,

		// 按钮设置
		button_image_url : "${baseURL}/js/swfupload/uploadbutton.png",	// 按钮图标
		button_placeholder_id : "spanButtonPlaceholder",
		button_width: 100,
		button_height: 25,
					
		// swf设置
		flash_url : "${baseURL}/js/swfupload/swfupload.swf",
					

		custom_settings : {
			progressTarget : "imgUploadProgress",
			cancelButtonId : "btnCancel",
			imgBoxObj : $("imgattachlist")
		},
					
			// Debug 设置
			debug: false
		});
	  }
	  function uploadStart()
	  {
	  this.addPostParam('supplierUser', '${sessionScope.supplierUser}');
	  }
		function fileDialogComplete(numFilesSelected, numFilesQueued, numFilesInQueue) {
			this.startUpload();
		}
		function uploadSuccess(file, serverData) {
			var item = $.parseJSON(serverData);
			var pic1=$("#supplierPic1").val();
			var pic2=$("#supplierPic2").val();
			var pic3=$("#supplierPic3").val();
			var pic4=$("#supplierPic4").val();
			var pic5=$("#supplierPic5").val();
			if(pic1=="")
				 $("#supplierPic1").val(item);
			else if(pic2=="")
			 $("#supplierPic2").val(item);
			else if(pic3=="")
				 $("#supplierPic3").val(item);
			else if(pic4=="")
				 $("#supplierPic4").val(item);
			else if(pic5=="")
				 $("#supplierPic5").val(item);
			if (this.getStats().files_queued === 0) {
			} else {
				this.startUpload();
			}
		}
		
		function iFrameHeight1() {   
			var ifm= document.getElementById("scfj");   
			var subWeb = document.frames ? document.frames["scfj"].document : ifm.contentDocument;   
			if(ifm != null && subWeb != null) {
			   ifm.height = subWeb.body.scrollHeight;
			}   
		}
		
		function picFuzhi(){
			var idNew = $("#idNew").val();
			$.post('${ctx}/wjsc/getFileBmList/'+idNew,function(data, textStatus) {
				if(textStatus == 'success') {
					for(var a=0;a<data.length;a++){
						$("#supplierPic" + a).val(data[a].wjbm);
					}
					
					editor1.sync();
					$("#myForm").submit();
					//document.getElementById("myForm").submit();
				}
			},"json"); 
		}
</SCRIPT>
<div class='adduser'>
	<div class='adduser-left'><div class='adduser-icon'></div><span>公司信息</span></div>
</div>
<center style='padding-top:20px;padding-bottom:20px;'>
<div class='section-right-order'>
<form name="myForm" id="myForm" method="POST" action="${ctx}/supplierAdmin/editInfo">
	<TABLE width='95%' class='table-border' cellpadding=0 cellspacing=0>
		<input type="hidden" name="id" id="id" value="${formdata.id}" />
		<input type="hidden" name="idNew" id="idNew" value="${idNew}" />
		<input name="supplierPic1" type="hidden" class="myInput" id="supplierPic0" value="${formdata.supplierPic1}"/>
		<input name="supplierPic2" type="hidden" class="myInput" id="supplierPic1" value="${formdata.supplierPic2}"/>
		<input name="supplierPic3" type="hidden" class="myInput" id="supplierPic2" value="${formdata.supplierPic3}" />
		<input name="supplierPic4" type="hidden" class="myInput" id="supplierPic3" value="${formdata.supplierPic4}" />
		<input name="supplierPic5" type="hidden" class="myInput" id="supplierPic4" value="${formdata.supplierPic5}" />
		<TR>
			<TD class='tr-title' >&nbsp;&nbsp;&nbsp;供应商展示信息</TD>
		</TR>
		<TR>
			<TD width='100%'>
				<TABLE width='100%' border=0 cellpadding=2 cellspacing=2 id="content-input">
					
					<TR>
						<TD width='150' align='right'>供货商：</TD>
						<td align="left">${sessionScope.supplier.supplierName}</td>
					</TR>
					<TR>
						<TD width='150' align='right'>供应商介绍：</TD>
						<td>
							<link rel="stylesheet" href="${baseURL}/kindeditor417/themes/default/default.css" />
							<link rel="stylesheet" href="${baseURL}/kindeditor417/plugins/code/prettify.css" />
							<script charset="utf-8" src="${baseURL}/kindeditor417/kindeditor-all-min.js"></script>
							<script charset="utf-8" src="${baseURL}/kindeditor417/lang/zh_CN.js"></script>
							<script charset="utf-8" src="${baseURL}/kindeditor417/plugins/code/prettify.js"></script>
							<script>
								KindEditor.ready(function(K) {
									editor1 = K.create('textarea[name="supplierInfo"]', {
										cssPath : '${baseURL}/kindeditor417/plugins/code/prettify.css',
										uploadJson : '${baseURL}/kindeditor417/jsp/upload_json.jsp',
										fileManagerJson : '${baseURL}/kindeditor417/jsp/file_manager_json.jsp',
										allowFileManager : true,
										afterCreate : function() {
											var self = this;
											K.ctrl(document, 13, function() {
												self.sync();
												K('form[name=myForm]')[0].submit();
											});
											K.ctrl(self.edit.doc, 13, function() {
												self.sync();
												K('form[name=myForm]')[0].submit();
											});
										}
									});
									prettyPrint();
								});
								
							</script>
					  		<textarea name="supplierInfo" cols="60" rows="20" class="myInput" id="supplierInfo">${formdata.supplierInfo}</textarea>
					  </td>
					<TR>
						<TD width='150' align='right'>展示图片：</TD>
						<td>
							<!-- <div class="flash" id="fsUploadProgress"></div>
						    <div style="padding-left: 5px;">
							  	<span id="spanButtonPlaceholder"></span>
							  	<input id="btnCancel" type="button" value="取消" onclick="cancelQueue(upload);" disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt;" />
						  	</div> -->
						  	<iframe width=100% height=90 frameborder=0 id="scfj" scrolling=no src="${baseURL}/wjsc/query/${idNew}/update" onload="iFrameHeight1()"></iframe>
						</td>
					</TR>
					<%-- <tr>
						<td colspan="2">
						<div id=imgattachlist>
						<table class="tfm up_row mbm" cellspacing=0 cellpadding=0>
						<tbody id=attachbody></tbody></table>
						</div>
						<div id=imgUploadProgress class="fieldset flash">
						</div>
						</td>
						</tr>
						<tr>
						<td>
						<input name="productPic1" type="hidden" class="myInput" id="productPic1" value="${formdata.productPic1}"/>
						<input name="productPic2" type="hidden" class="myInput" id="productPic2"  value="${formdata.productPic2}"/>
						<input name="productPic3" type="hidden" class="myInput" id="productPic3" value="${formdata.productPic3}" />
						<input name="productPic4" type="hidden" class="myInput" id="productPic4" value="${formdata.productPic4}" />
						<input name="productPic5" type="hidden" class="myInput" id="productPic5" value="${formdata.productPic5}" />
						</td>
					</tr> --%>
				
				    <TR>
						<td height="65" align="center" colspan=2>
							<table width="200" border="0" cellspacing="0" cellpadding="0">
								<tr>
								 <td valign="middle">
								  	<input class="btnstyle" type="button" value="提交" onclick="picFuzhi()"/>
								  </td>
								  <td align="center" valign="middle" >&nbsp;</td>
								  <td valign="middle" >
								  	<input name="button" class="btnstyle" type="button" onclick="history.go(-1)" value="返回" />
								  </td>
								</tr>
							</table>
						</td>
					</TR>
					<tr>
					  <td colspan="4" align="center">&nbsp;</td>
				    </tr>
				</TABLE>
			</TD>
		</TR>
	</TABLE>
	</form>
</div>
</center>

					
<%@ include file="../include/bottom.jsp" %>